/* 
 * File:   InputHandler.h
 * Copyright (C) 2008, 2009
 *		Sergio Padrino Recio (PadrinatoR)
 *
 * Created on 8 de septiembre de 2008, 19:40
 *
 * This file is part of BombProject.
 * 
 * BombProject is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
   
 * BombProject is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with BombProject.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _INPUTHANDLER_H
#define	_INPUTHANDLER_H

#include "InputDevice.h"
#include <vector>

using namespace std;

/**
 * This class will handle <b>every</b> input device that can be used in the application.
 * @see InputDevice
 */
class InputHandler {
private:
	static InputHandler* mSingletonInstance;
	vector<InputDevice*> mDevicesList;
	
public:
	static InputHandler* getInstance();
	static void deleteInstance();
	
	InputHandler();
	~InputHandler();
	
	void detectDevices();
	ButtonState* getLinkFromPressedButton(DeviceButtonInfo& button_info);
	ButtonState* getLinkFromButtonInfo(DeviceButtonInfo& button_info);
	
	void update();
	
	void destroy();
	//TODO: bool checkConfiguration(puntero a la estructura explicada arriba...); //Comprueba si un botón aún es 'pulsable', para evitar comportamientos incorrectos cuando alguien desconecta algún dispositivo. SOLO AL INICIO DEL PROGRAMA PARA COMPROBAR LA CONFIGURACION GUARDADA
};

/**
 * Global singleton Input Handler instance.
 */
extern InputHandler* gInputHandler;

#endif	/* _INPUTHANDLER_H */

